import { Component, OnInit } from '@angular/core';

@Component({
  selector: 'app-news',
  templateUrl: './news.component.html',
  styleUrls: ['./news.component.scss']
})
export class NewsComponent implements OnInit {

  public title = "我是一个新闻组件--ts";

  msg = "少年阿鑫加油！";

  private username: string = '张三';

  public student: any = '我是一个学生的属性（数据）';

public userinfo:any={

    username: "张三",
    age: '23'
  }


  public message: any;

  public content = "<h2>我是一个html标签</h2>";

  //定义数组
  public arr = ['1111','2222','3333'];

  public list:any[] = ['我是第一个新闻',2222,'我是第三个'];

  public items:Array<String> = ['我是第一个新闻','2222','我是第三个'];


  public userList: any[] = [{
    username: '小明',
    age: '20'
  },
  {
    username: '小红',
    age: '22'
  },
  {
   username: '小军',
   age: '34'
  }]

  public cars:any[]=[
    {
      brand:"宝马",
      list: [
        {
          title:'宝马x1',
          price: '20万'
        },
        {
          title:'宝马x2',
          price: '30万'
        },
        {
          title:'宝马x3',
          price: '40万'
        }
      ]
    },
    {
      brand:"奥迪",
      list: [
        {
          title:'奥迪Q1',
          price: '20万'
        },
        {
          title:'奥迪Q2',
          price: '30万'
        },
        {
          title:'奥迪Q3',
          price: '40万'
        }
      ]
    }
  ]


  /**
   * 声明属性的几种方式
   */


  constructor() {
    this.message = '这是给属性赋值--（改变属性的值）'

    console.log(this.msg);

    this.msg='我是改变后的msg的值';
   }

  ngOnInit(): void {
  }

}
